/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package org.streamerstudio.model.gstreamer.impl;

import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EPackage;

import org.eclipse.emf.ecore.impl.EPackageImpl;

import org.gstreamer.ElementFactory;

import org.streamerstudio.model.gstreamer.GstreamerFactory;
import org.streamerstudio.model.gstreamer.GstreamerPackage;

import org.streamerstudio.model.gstreamer.registry.RegistryPackage;

import org.streamerstudio.model.gstreamer.registry.impl.RegistryPackageImpl;

import org.streamerstudio.model.gstreamer.target.TargetPackage;

import org.streamerstudio.model.gstreamer.target.impl.TargetPackageImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Package</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class GstreamerPackageImpl extends EPackageImpl implements GstreamerPackage {
	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EDataType elementFactoryEDataType = null;

	/**
	 * Creates an instance of the model <b>Package</b>, registered with
	 * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
	 * package URI value.
	 * <p>Note: the correct way to create the package is via the static
	 * factory method {@link #init init()}, which also performs
	 * initialization of the package, or returns the registered package,
	 * if one already exists.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see org.eclipse.emf.ecore.EPackage.Registry
	 * @see org.streamerstudio.model.gstreamer.GstreamerPackage#eNS_URI
	 * @see #init()
	 * @generated
	 */
	private GstreamerPackageImpl() {
		super(eNS_URI, GstreamerFactory.eINSTANCE);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private static boolean isInited = false;

	/**
	 * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
	 * 
	 * <p>This method is used to initialize {@link GstreamerPackage#eINSTANCE} when that field is accessed.
	 * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #eNS_URI
	 * @see #createPackageContents()
	 * @see #initializePackageContents()
	 * @generated
	 */
	public static GstreamerPackage init() {
		if (isInited) return (GstreamerPackage)EPackage.Registry.INSTANCE.getEPackage(GstreamerPackage.eNS_URI);

		// Obtain or create and register package
		GstreamerPackageImpl theGstreamerPackage = (GstreamerPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof GstreamerPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new GstreamerPackageImpl());

		isInited = true;

		// Obtain or create and register interdependencies
		TargetPackageImpl theTargetPackage = (TargetPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(TargetPackage.eNS_URI) instanceof TargetPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(TargetPackage.eNS_URI) : TargetPackage.eINSTANCE);
		RegistryPackageImpl theRegistryPackage = (RegistryPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(RegistryPackage.eNS_URI) instanceof RegistryPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(RegistryPackage.eNS_URI) : RegistryPackage.eINSTANCE);

		// Create package meta-data objects
		theGstreamerPackage.createPackageContents();
		theTargetPackage.createPackageContents();
		theRegistryPackage.createPackageContents();

		// Initialize created meta-data
		theGstreamerPackage.initializePackageContents();
		theTargetPackage.initializePackageContents();
		theRegistryPackage.initializePackageContents();

		// Mark meta-data to indicate it can't be changed
		theGstreamerPackage.freeze();

  
		// Update the registry and return the package
		EPackage.Registry.INSTANCE.put(GstreamerPackage.eNS_URI, theGstreamerPackage);
		return theGstreamerPackage;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EDataType getElementFactory() {
		return elementFactoryEDataType;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public GstreamerFactory getGstreamerFactory() {
		return (GstreamerFactory)getEFactoryInstance();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private boolean isCreated = false;

	/**
	 * Creates the meta-model objects for the package.  This method is
	 * guarded to have no affect on any invocation but its first.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void createPackageContents() {
		if (isCreated) return;
		isCreated = true;

		// Create data types
		elementFactoryEDataType = createEDataType(ELEMENT_FACTORY);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private boolean isInitialized = false;

	/**
	 * Complete the initialization of the package and its meta-model.  This
	 * method is guarded to have no affect on any invocation but its first.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void initializePackageContents() {
		if (isInitialized) return;
		isInitialized = true;

		// Initialize package
		setName(eNAME);
		setNsPrefix(eNS_PREFIX);
		setNsURI(eNS_URI);

		// Obtain other dependent packages
		TargetPackage theTargetPackage = (TargetPackage)EPackage.Registry.INSTANCE.getEPackage(TargetPackage.eNS_URI);
		RegistryPackage theRegistryPackage = (RegistryPackage)EPackage.Registry.INSTANCE.getEPackage(RegistryPackage.eNS_URI);

		// Add subpackages
		getESubpackages().add(theTargetPackage);
		getESubpackages().add(theRegistryPackage);

		// Initialize data types
		initEDataType(elementFactoryEDataType, ElementFactory.class, "ElementFactory", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);

		// Create resource
		createResource(eNS_URI);
	}

} //GstreamerPackageImpl
